package cn.wit.summit.chwan.Stat;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;

import com.meituan.android.walle.WalleChannelReader;

import cn.wit.summit.chwan.utils.AccountUtil;
import cn.wit.summit.chwan.utils.StringUtils;
import cn.wit.summit.chwan.utils.SystemInfoUtils;
import freemarker.template.utility.StringUtil;

public class StatbeanBase {
    private String ouid;
    private String deviceId;
    private String mac;
    private String imei;
    private String deviceType;
    private String appVersion="";
    private String adId;
    private String phoneBrand;
    private String phoneModle;
    private long clickTime;

    public StatbeanBase(Context context) {
        imei = SystemInfoUtils.getInstance(context).getIMEI();
        ouid= AccountUtil.getInstance().getUid()+"";
        deviceId= SystemInfoUtils.getInstance(context).getDeviceId();
        mac=SystemInfoUtils.getInstance(context).getMacAddress();
        phoneBrand = Build.BRAND;
        phoneModle = Build.MODEL;
        clickTime = System.currentTimeMillis();
        deviceType="android";
        adId= WalleChannelReader.get(context,"adId");
        if (StringUtils.isEmpty(adId)){
            adId="0";
        }
        try {
            PackageInfo packageInfo=context.getPackageManager().getPackageInfo(context.getPackageName(),0);
            appVersion=packageInfo.versionCode+"_"+packageInfo.versionName;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public String getAdId() {
        return adId;
    }

    public void setAdId(String adId) {
        this.adId = adId;
    }

    public String getOuid() {
        return ouid;
    }

    public void setOuid(String ouid) {
        this.ouid = ouid;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public String getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }

    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    public String getPhoneModle() {
        return phoneModle;
    }

    public void setPhoneModle(String phoneModle) {
        this.phoneModle = phoneModle;
    }

    public long getClickTime() {
        return clickTime;
    }

    public void setClickTime(long clickTime) {
        this.clickTime = clickTime;
    }

    public String getPhoneBrand() {
        return phoneBrand;
    }

    public void setPhoneBrand(String phoneBrand) {
        this.phoneBrand = phoneBrand;
    }
}
